package Q3;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String str = " " + scanner.nextLine() + " ";

        int len = str.length();
        int blankCount = 0; //空格个数
        for (int i = 0; i < len; i++) {
            if (str.charAt(i) == ' ') {
                blankCount++;
            }
        }

        int[][] blankIndex = new int[blankCount - 1][2];
        int count = 0;
        blankIndex[0][0] = 1;
        blankIndex[blankCount - 1 - 1][1] = len - 1;
        for (int i = 1; i < len - 1; i++) {
            if (str.charAt(i) == ' ') {
                blankIndex[count++][1] = i; //结束位置
                blankIndex[count][0] = i + 1; //开始位置
            }
        }

        for (int i = blankCount - 1 - 1; i >= 0; i--) {
            int startIndex = blankIndex[i][0];
            int endIndex = blankIndex[i][1];
            System.out.print(str.substring(startIndex, endIndex) + " ");
        }

    }
}
